package com.example.warehouse.mapper;

import com.example.warehouse.dto.InventoryReportDTO;
import com.example.warehouse.entity.Inventory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;


@Mapper
public interface InventoryMapper {

    Inventory findByProductId(Long productId);

    void updateInventory(Inventory inventory);

    // 根据商品ID获取库存数量
    Integer getInventoryByProductId(Long productId);

    //获取商品的库存预警
    Integer getInventoryWarningByProductId(@Param("productId") Long productId, @Param("threshold") int threshold);
    // 插入库存记录
    void insertInventory(Inventory inventory);


    // 根据商品ID删除库存记录
    void deleteInventoryByProductId(Long productId);



    // 批量更新库存
    void updateInventoryBatch(@Param("inventoryList") List<Inventory> inventoryList);


    // 获取日报表
    List<InventoryReportDTO> getInventoryReportByDate(LocalDate date);

    // 获取月报表
    List<InventoryReportDTO> getInventoryReportByMonth(LocalDate startDate, LocalDate endDate);

    // 获取年报表
    List<InventoryReportDTO> getInventoryReportByYear(LocalDate startDate, LocalDate endDate);
}